<template>
<div>
    <button @click="pay">支付</button>
    <button @click="down">下载</button>
    <div id="result" style="height: 300px;"></div>
</div>

</template>

<script  setup>
import axios from "axios";
import {ref} from "vue"
let result = ref();

let down  = ()=>{
    let url = "http://localhost:80/assets/abc.xlsx";

    let a = document.createElement("a");
    a.href = url;
    a.download= "psd.xlsx";
    a.click();
    a.remove();
}
let pay = ()=>{
    // let orderId = req.body.orderId;
    // let orderMoney = req.body.orderMoney;
    // let orderTitle = req.body.orderTitle;
    // let orderInfo = req.body.orderInfo;

    axios({
        method:"post",
        url:"/api/pay",
        data:{
            orderId:"dfaqdlklfj1212121",
            orderMoney:13,
            orderTitle:"标题",
            orderInfo:"测试的内容"
        }
    }).then(res=>{
        console.log(res.data.result);
        //document.getElementById("result").innerHTML= res.data.result;
        window.location.href = res.data.result;
    })

}
</script>

<style  scoped></style>
